package com.samehope.ar.controller;


import com.samehope.ar.common.CommonResult;
import com.samehope.ar.dto.TaskPointQueryParam;
import com.samehope.ar.service.ITaskPointService;
import com.samehope.ar.vo.TaskPointDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 巡检点快照 前端控制器
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
@RestController
@RequestMapping("/taskPoint")
public class TaskPointController {

    @Autowired
    private ITaskPointService taskPointService;

    /**
     * 根据任务查询巡检点日志
     * @param taskId
     * @return
     */
    @GetMapping("/findByTask")
    public CommonResult findByTask(@RequestParam(required = true) Long taskId){

        return CommonResult.success(taskPointService.findByTaskOrPoint(taskId, null));
    }

    /**
     * 查询单个巡检点日志
     * @param patrolPointId
     * @return
     */
    @GetMapping("/findByPatrolPoint")
    public CommonResult findByPatrolPoint(@RequestParam(required = true) Long patrolPointId){

        return CommonResult.success(taskPointService.findByTaskOrPoint(null, patrolPointId));
    }

}
